package actions;



import game.constants.ReferenceAction;
import interfaces.ActionInterface;
import interfaces.impl.Action;
import objects.WorldObject;
import universe.Universe;

public class ActionCreateObject extends Action{
	
	WorldObject objectToCreate=null;

	@Override
	public boolean processActionChild(Universe universe) {
		universe.addObject(objectToCreate);
		return false;
	}

	@Override
	public void initializeName() {
		name="Create Object";
		
	}

	@Override
	public void initializeId() {
		this.id=ReferenceAction.ACTION_CREATE_OBJECT;
		
	}

	@Override
	public void modifyChild(ActionInterface action) {
			if (action instanceof ActionCreateObject) {
				ActionCreateObject ac = (ActionCreateObject) action;
				
				this.objectToCreate=ac.objectToCreate;
				
			}
		
	}

	public WorldObject getObjectToCreate() {
		return objectToCreate;
	}

	public void setObjectToCreate(WorldObject objectToCreate) {
		this.objectToCreate = objectToCreate;
	}
	
	@Override
	public ActionCreateObject cloneAction(){
		ActionCreateObject action = new ActionCreateObject();
		action.modifyAction(this);
		return action;
		
	}

}
